from django.db import models

# Create your models here.
# 定义模型，模型类都要继承自models.Model
class UserInfo(models.Model):
    # db_table = "user"
    user_name = models.CharField(max_length=30, null=False)
    user_email = models.EmailField(max_length=128, null=False)
    user_phone = models.CharField(max_length=128, null=False)
    user_passwd = models.CharField(max_length=128, null=False)
    user_image = models.TextField(max_length=1024)
    user_fans = models.IntegerField(default=0)
    user_attention = models.IntegerField(default=0)

class Rsa_Key(models.Model):
    pub_key = models.TextField(max_length=2048, null=False)
    pri_key = models.TextField(max_length=2048, null=False)

class Session_Self(models.Model):
    """sessionid发送给前端作为缓存，组成是userid+4位随机数"""
    sessionid = models.TextField(max_length=2048, null=False)
    userid = models.CharField(primary_key=True, null=False, max_length=255)
    """用户状态，login"""
    userstatus = models.TextField(max_length=512, null=False, default='login')